<?php 
/* ================================================================================
 * Portal	 
 *
 * Author: Eric Hendrickson (enhendrickson@liberty.edu)
 * Date: 4/25/08
   ================================================================================ */
	
	global $SSO, $Security, $AppID, $User, $DB;
	
	//Check to see if there is a valid session 
	$SessionInfo = $SSO->isValidSession("index.php?action=login", $SSO->getSessionInformation());	
	
	//Grab the user info
	$UserInfo = $User->GetUserInfo($SessionInfo['username']);

	$sql = "select AppName,AppPath,AppPurpose,AppDescription from users " .
			  " join access on users.username = access.username " .
			  " join apps on access.appid = apps.appid " .
			  " where users.username = '" . $SessionInfo['username'] . "'" .
	          " order by AppName";
	
	$DB->query($sql);
	
	if($DB->get_num_rows()>0) {
?>
<table class="PortalWidget" cellspacing="0">
	<tr>
		<td class="PortalWidgetTitle">Applications</td>
	</tr>
	<tr>
		<td>
			<table class="PortalWidgetContent">
<?php 
	while($row = $DB->fetch_row()) {
		print '<tr>';
		print '<td style="border-bottom: 1px solid #ccc;">';
		print '<a href="http://'.$_SERVER['HTTP_HOST'].'/'.$row['AppPath'].'">'.$row['AppName'].'</a>';
		print '</td>';
		print '</tr>';
		print '<tr>';
		print '<td>' .$row['AppPurpose']. '</td>';
		print '</tr>';
		print '<tr>';
		print '<td>' .$row['AppDescription']. '</td>';
		print '</tr>';
		print '<tr><td><br><br></td></tr>';
	}
?>
			</table>
		</td>
	</tr>	
</table>
<?php
}
?>